package com.xidian.zhiancloud.controller.systemset;

import com.xidian.zhiancloud.controller.base.BaseController;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.syset.SysBasicSetting;
import com.xidian.zhiancloud.service.user.IBasicSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统设置-系统个性化设置
 */
@RestController
@RequestMapping("/basicSetting")
public class BasicSettingController extends BaseController {

    @Autowired
    IBasicSettingService basicSettingService;

    /**
     * 查询返回列表页面
     * @return 返回ResultDTO对象
     */
    @RequestMapping("/selectBasicSettingList")
    public ResultDTO selectBasicSettingList() {
        return ResultDTO.successOf(basicSettingService.selectBasicSettingList(this.getSessionUserCompanyId()),GeneralResponseEnums.SUCCESS);
    }

    /**
     * 上传添加
     * @param id 系统个性化ID
     * @param basicSetting 系统基础信息
     * @return 返回ResultDTO对象
     */
    @RequestMapping("/addBasicSetting")
    public ResultDTO addBasicSetting
        (@RequestParam(value = "id",required = false,defaultValue = "0")
                 String id,
            SysBasicSetting basicSetting) {
        basicSetting.setCompanyId(this.getSessionUserCompanyId());
        basicSettingService.addBasicSetting(id,basicSetting);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

}
